import { Tabs } from "antd";
import { Outlet, useLocation, useNavigate } from "react-router-dom";

const Search = () => {
  const navigate = useNavigate();
  const { pathname } = useLocation();
  return (
    <div>
      <Tabs
        activeKey={pathname}
        items={[
          {
            key: "/list/search/applications",
            label: "应用",
          },
          {
            key: "/list/search/articles",
            label: "文章",
          },
          {
            key: "/list/search/projects",
            label: "项目",
          },
        ]}
        onChange={(key) => {
          navigate(key);
        }}
      />

      {/* 渲染子级 */}
      <Outlet />
    </div>
  );
};

export default Search;
